package com.lucun.es_transaction.controller;

/**
 * @Author: 郭鑫
 * @catalogue: com.lucun.es_transaction.controller
 * @Date: 2021/6/3 11:41
 * @Version: 1.0
 */
import com.lucun.es_transaction.config.RolePermission;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Slf4j
@Controller
public class WebSocketController {
    @RolePermission(login = false)
    @RequestMapping("/websocket/{name}")
    public String webSocket(@PathVariable String name, Model model) {
        try {
            log.info("跳转到websocket的页面上");
            model.addAttribute("username", name);
            return "websocket";
        } catch (Exception e) {
            log.info("跳转到websocket的页面上发生异常，异常信息是：" + e.getMessage());
            return "error";
        }
    }
}